package com.dreamcar.auction.ejb;

import java.util.List;
import java.util.Set;

import javax.ejb.Local;

import com.dreamcar.auction.entity.Bid;
import com.dreamcar.auction.entity.CarModel;
import com.dreamcar.auction.entity.Component;
import com.dreamcar.auction.entity.DestinationMarket;
import com.dreamcar.auction.entity.Request;
import com.dreamcar.auction.enums.RequestStatusEnum;
import com.dreamcar.auction.exception.InvalidBidRequestException;
import com.dreamcar.inventory.ws.RequestDTO;

@Local
public interface ReverseAuctionFacadeLocal {
	
	//****Consultas para filtrar Componentes ***//
	public List<DestinationMarket> findAllDestinationMarket();
	
	public List<CarModel> findCarModelByDestinationMarket(Integer idDestinationMarket);
	
	public List<Component> findCarComponentByCarModel(Integer idCarModel, String discriminator);
	
	//*** Solo operaciones a BD ***//
	public Request updateRequest(Request request);
	
	public Set<Bid> findBidsRequest(Integer requestId);
	
	public List<Request> findRequestByExampleAndComponent(Request example, Integer idComponent);
	
	//*** Contienen Logica de Negocio ***//
	public void validateAndSaveRequest(RequestDTO requestDTO, Request request, 
			Integer componentId, String username)
		throws InvalidBidRequestException;
	
	public void scheduleWork(RequestDTO requestDTO, Integer requestId, RequestStatusEnum status);
	
	public void issuePO(Integer requestId, Integer bidId, String username);
	
	public void submitBid(Bid bid, Integer idRequest, String username) throws InvalidBidRequestException;
	
	public void chooseWinnerBid();
	
}